﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TMT.Data.Entities;
using TMT.Data.Service;
using TMT.Data.Base;

namespace TMT.Data
{
    //public partial class Page
    //{
    //    public static TMTPage ToTMTPage(this Page page)
    //    {
    //        TMTPage retValue = new TMTPage()
    //        {
    //            BaseInfo = page,
    //            ParentPage = page.Page1._PageTitle
    //        };
    //        return retValue;
    //    }
    //}

    public static class Extensions
    {
        public static TMTPage ToTMTPage(this Page page)
        {
            TMTPage retValue = new TMTPage()
            {
                BaseInfo = page,
                ParentPage = page.ParentId.HasValue?PageService.Instance.GetPageById(page.ParentId.Value).PageTitle:string.Empty
            };
            return retValue;
        }
    }
}
